#pragma once

#include "d3dUtil.h"
#include "Camera.h"

/* 
	Class: CModel
	 Use for loading and rendering .X model
	 Shading: Phong model
 */
class CModel
{
public:
	CModel(void);
	virtual ~CModel(void);

	void LoadModelFromXFile(const char* strXFileName);
	void Update(float dt);
	void Render();
	void BuildFX();

	void OnLostDevice();
	void OnResetDevice();

private:
	ID3DXMesh* mMesh;
	std::vector<Mtrl> mMtrl;
	std::vector<IDirect3DTexture9*> mTex;

	IDirect3DTexture9* mWhiteTex;

	ID3DXEffect* mFX;
	D3DXHANDLE   mhTech;
	D3DXHANDLE   mhWVP;
	D3DXHANDLE   mhWorldInvTrans;
	D3DXHANDLE   mhEyePos;
	D3DXHANDLE   mhWorld;
	D3DXHANDLE   mhTex;
	D3DXHANDLE   mhMtrl;
	D3DXHANDLE   mhLight;

	DirLight mLight;

	D3DXMATRIX mWorld;	
};
